'''
===========
limber.main
===========

This module contains the functions to run LimberEditor.
'''

import os
import sys

from limber import application
from limber import utils

DEFAULT_USERDIR = os.path.join(os.path.expanduser('~'), '.limber')

if utils.WIN_PLATFORM:
    DEFAULT_SYSTEMDIR = 'C:\\Program Files'
else:
    DEFAULT_SYSTEMDIR = os.path.join(os.sep, os.path.join('usr', 'share', 'limber'))

def run(userdir=DEFAULT_USERDIR, sysdir=DEFAULT_SYSTEMDIR):
    '''Runs LimberEditor and returns its exit code.'''
    
    app = application.Application(userdir, sysdir)
    return app.exec_()

def main():
    sys.exit(run())
